/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2011 All Rights Reserved.
 */
package com.alipay.supergw.common.dal.share_supergw.auto.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.alipay.supergw.common.dal.share_supergw.auto.daointerface.TranstypeChannelMapDAO;
import com.alipay.supergw.common.dal.share_supergw.auto.dataobject.TranstypeChannelMapDO;

/**
 * An ibatis based implementation of dao interface <tt>com.alipay.supergw.common.dal.share_supergw.auto.daointerface.TranstypeChannelMapDAO</tt>.
 *
 * This file is generated by <tt>supergw-dalgen</tt>, a DAL (Data Access Layer)
 * code generation utility specially developed for <tt>supergw</tt> project.
 * 
 * PLEASE DO NOT MODIFY THIS FILE MANUALLY, or else your modification may
 * be OVERWRITTEN by someone else. To modify the file, you should go to 
 * directory <tt>(project-home)/dalgen</tt>, and 
 * find the corresponding configuration file (<tt>tables/sgw_transtype_channel_map.xml</tt>). 
 * Modify the configuration file according to your needs, then run <tt>supergw-dalgen</tt> 
 * to generate this file.
 */
public class IbatisTranstypeChannelMapDAO extends SqlMapClientDaoSupport implements
                                                                        TranstypeChannelMapDAO {

    /**
     *  Query DB table <tt>sgw_transtype_channel_map</tt> for records.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>select trans_type_id, channel_system_id, out_trans_code_id, memo, gmt_create, gmt_modified from sgw_transtype_channel_map</tt>
     *
     *	@return List<TranstypeChannelMapDO>
     *	@throws DataAccessException
     */
    @SuppressWarnings("unchecked")
    public List<TranstypeChannelMapDO> loadAll() throws DataAccessException {

        return getSqlMapClientTemplate().queryForList("MS-TRANSTYPE-CHANNEL-MAP-LOAD-ALL", null);

    }

    /**
     *  Insert one <tt>TranstypeChannelMapDO</tt> object to DB table <tt>sgw_transtype_channel_map</tt>, return primary key
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>insert into sgw_transtype_channel_map(trans_type_id,channel_system_id,out_trans_code_id,memo,gmt_create,gmt_modified) values (?, ?, ?, ?, sysdate, sysdate)</tt>
     *
     *	@param transtypeChannelMap
     *	@return String
     *	@throws DataAccessException
     */
    public String insert(TranstypeChannelMapDO transtypeChannelMap) throws DataAccessException {
        if (transtypeChannelMap == null) {
            throw new IllegalArgumentException("Can't insert a null data object into db.");
        }

        getSqlMapClientTemplate().insert("MS-TRANSTYPE-CHANNEL-MAP-INSERT", transtypeChannelMap);

        return transtypeChannelMap.getTransTypeId();
    }

    /**
     *  Update DB table <tt>sgw_transtype_channel_map</tt>.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>update sgw_transtype_channel_map set out_trans_code_id=?, memo=?, gmt_modified=sysdate where ((trans_type_id = ?) AND (channel_system_id = ?))</tt>
     *
     *	@param outTransCodeId
     *	@param memo
     *	@param transTypeId
     *	@param channelSystemId
     *	@return int
     *	@throws DataAccessException
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public int update(String outTransCodeId, String memo, String transTypeId, String channelSystemId)
                                                                                                     throws DataAccessException {
        Map param = new HashMap();

        param.put("outTransCodeId", outTransCodeId);
        param.put("memo", memo);
        param.put("transTypeId", transTypeId);
        param.put("channelSystemId", channelSystemId);

        return getSqlMapClientTemplate().update("MS-TRANSTYPE-CHANNEL-MAP-UPDATE", param);
    }

    /**
     *  Query DB table <tt>sgw_transtype_channel_map</tt> for records.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>select trans_type_id, channel_system_id, out_trans_code_id, memo, gmt_create, gmt_modified from sgw_transtype_channel_map where ((trans_type_id = ?) AND (channel_system_id = ?) AND (out_trans_code_id = ?))</tt>
     *
     *	@param transTypeId
     *	@param channelSystemId
     *	@param outTransCodeId
     *	@return List<TranstypeChannelMapDO>
     *	@throws DataAccessException
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public List<TranstypeChannelMapDO> select(String transTypeId, String channelSystemId,
                                              String outTransCodeId) throws DataAccessException {
        Map param = new HashMap();

        param.put("transTypeId", transTypeId);
        param.put("channelSystemId", channelSystemId);
        param.put("outTransCodeId", outTransCodeId);

        return getSqlMapClientTemplate().queryForList("MS-TRANSTYPE-CHANNEL-MAP-SELECT", param);

    }

    /**
     *  Delete records from DB table <tt>sgw_transtype_channel_map</tt>.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>delete from sgw_transtype_channel_map where ((trans_type_id = ?) AND (channel_system_id = ?))</tt>
     *
     *	@param transTypeId
     *	@param channelSystemId
     *	@return int
     *	@throws DataAccessException
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public int delete(String transTypeId, String channelSystemId) throws DataAccessException {
        Map param = new HashMap();

        param.put("transTypeId", transTypeId);
        param.put("channelSystemId", channelSystemId);

        return getSqlMapClientTemplate().delete("MS-TRANSTYPE-CHANNEL-MAP-DELETE", param);
    }

}